﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace NetRosApp.PlaPart
{
    public partial class ReportSelectorFrm : XtraForm
    {
         public int tipispisa = 0;
        public ReportSelectorFrm()
        {
            InitializeComponent();
            pisaci.Properties.Items.AddRange(PlaPrinterUtility.GetPrintere());
            pisaci.EditValue = PlaPrinterUtility.GetPrinterToPrinter();
            kopija.EditValue = PlaPrinterUtility.BrojKopija;
            radioGroup1.EditValue = PlaPrinterUtility.PreglediliIspis;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Close();
        }

        private void LBIzabir_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char) Keys.Enter)
            {
                DialogResult = DialogResult.OK;
                tipispisa = (int)radioGroup1.EditValue;
                Close();
            }
        }

        private void LBIzabir_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            DialogResult = DialogResult.OK;
            tipispisa = (int)radioGroup1.EditValue;
            Close();
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
         
                DialogResult = DialogResult.OK;
            tipispisa = 0;
                Close();
      }

        private void pisaci_EditValueChanged(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(pisaci.EditValue as string))
            {
               PlaPrinterUtility.SetPrinterToPrint(pisaci.EditValue as string);
            }
        }

        

        private void kopija_ValueChanged(object sender, EventArgs e)
        {
            PlaPrinterUtility.BrojKopija = Convert.ToInt16(kopija.Value);
        }

        private void simpleButton3_Click(object sender, EventArgs e)
        {
         
                DialogResult = DialogResult.OK;
                tipispisa = 1;
                Close();

        }

        private void radioGroup1_Validated(object sender, EventArgs e)
        {
            PlaPrinterUtility.PreglediliIspis = (int)radioGroup1.EditValue;
        }
    }
}